package com.fzc.rhinooffice.module.mall;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.fzc.rhinooffice.R;
import com.fzc.rhinooffice.common.SysApplication;
import com.fzc.rhinooffice.common.view.CustomProgress;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

/**
 * �̳ǽ���
 *
 * @author chao.liu
 */

public class MallFragment extends Fragment {

	private View view;
	@ViewInject(R.id.wb_mall)
	private WebView wb_mall;

	private CustomProgress customProgress;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
							 Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		view = inflater.inflate(R.layout.fragment_mall, container, false); // ����fragment����
		ViewUtils.inject(this, view); // ע��view���¼�


		customProgress = CustomProgress.init(getActivity(), getResources().getString(R.string.loading), false, null);
		//加载商城网址
		wb_mall.loadUrl(SysApplication.user.mallurl);
		wb_mall.setWebViewClient(new WebViewClient() {
			@Override
			public void onPageFinished(WebView view, String url) {
				super.onPageFinished(view, url);
				customProgress.dismiss();

			}

			@Override
			public void onPageStarted(WebView view, String url, Bitmap favicon) {
				super.onPageStarted(view, url, favicon);
				customProgress.show();
			}
		});
		return view;
	}
}
